//Copyright 2011 New York City 3D Community

//This file is part of New York City 3D.

//New York City 3D is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//New York City 3D is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with New York City 3D.  If not, see <http://www.gnu.org/licenses/>.

package nyc3d.settings;

import com.jme3.system.AppSettings;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import nyc3d.updates.UpdateManager;

public class SettingsUtility {

    public static AppSettings parseSettingsFromFile(String fileName) throws IOException{
        AppSettings settings = new AppSettings(true);

        settings.load(new FileInputStream("settings.nyc"));

        settings.setTitle("New York City 3D " + UpdateManager.gameVersion + " (" + UpdateManager.modifier + ")");
        settings.setUseJoysticks(true);

        return settings;
    }

    public static void writeSettingsToFile(String fileName, AppSettings settings) throws IOException{
        settings.save(new FileOutputStream("settings.nyc"));
    }

}
